package qaz.activity;

import qaz.adapter.IconNewsAdapter;
import qaz.news.R;
import android.app.Activity;
import android.opengl.Visibility;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

public class ContentViewActivity extends Activity {
	private int index;
	private static TextView tvMarqueTitle;
	private LinearLayout layout;
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.content_view);
		
		ImageView imgHeader= (ImageView)findViewById(R.id.header_image);
		tvMarqueTitle=(TextView)findViewById(R.id.tv_marque);
		layout = (LinearLayout) findViewById(R.id.content_news);
		TextView tv = new TextView(this);
		tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		tv.setText("some text some textsome textsome textsome textsome textsome text");
		Bundle extras = getIntent().getExtras(); 
		if (extras != null) {
		    index = extras.getInt("INDEX");
		    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(36, 18);
		    imgHeader.setLayoutParams(layoutParams);		    
		    imgHeader.setImageResource(IconNewsAdapter.mThumbIds[index]);
		    tvMarqueTitle=(TextView)findViewById(R.id.tv_marque);
		    String t= extras.getString("HEADNAME");
		    //t=t.concat(IconNewsAdapter.name[index]);
		    tvMarqueTitle.setText(t);
		}
		layout.addView(tv);
		final Button bt= new Button(this);
		bt.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				bt.setVisibility(View.GONE);
				ImageView imgView = new ImageView(getApplicationContext());
				imgView.setImageResource(R.drawable.vnmedia_vn);
				//layout.addView(imgView);
				layout.addView(imgView, 1);
			}
		});
		layout.addView(bt);
		TextView tv2 = new TextView(this);
		tv2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		tv2.setText("some text some textsome textsome textsome textsome textsome text\n\n\n\n\ngrea\n\n\n\n\n\nagrea\n\n\n\n\nrtaa\n\n\n\ngerq");
		layout.addView(tv2);
	}
}